Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect injections when using the syntax tree's root node #9424

Merged
merged 3 commits into from
Jan 28, 2024

Conversation

the-mikedavis
Copy link
Member

Previously we used the root syntax tree for bracket matching. We can use the new functionality in Syntax for finding the correct syntax tree for a given byte range though so we use the correct syntax tree within injections. This improves bracket matching behavior within HTML injections like script or style tags for example.

Fixes #9423

Previously we used the root syntax tree for bracket matching. We can use
the new functionality in `Syntax` for finding the correct syntax tree
for a given byte range though so we use the correct syntax tree within
injections. This improves bracket matching behavior within HTML
injections like script or style tags for example.
@the-mikedavis the-mikedavis added E-easy Call for participation: Experience needed to fix: Easy / not much A-tree-sitter Area: Tree-sitter S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 25, 2024
@the-mikedavis
Copy link
Member Author

There are a few other places where we can replace Syntax::tree with functions that take injections into account. I'll add some commits for fixing :tree-sitter-highlight-name and helix_core::movement::move_parent_node_end to this PR too since they're small. In the long run we should treat Syntax::tree as deprecated and remove it once we respect injection layers in the indent system

@the-mikedavis the-mikedavis changed the title Use injection syntax trees for bracket matching Respect injections when using the syntax tree's root node Jan 25, 2024
@archseer archseer merged commit 035b8ea into master Jan 28, 2024
6 checks passed
@archseer archseer deleted the match-brackets-within-injections branch January 28, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tree-sitter Area: Tree-sitter E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

match bracket wrong in <style> tag of html
2 participants